const { sureOrder } = require("../../../../../utils/api");

// component/sign-dialog/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    fatherData: {
      type: String,
      value: ''
    }

  },

  /**
   * 组件的初始数据
   */
  data: {


  },

  /**
   * 组件的方法列表
   */
  methods: {
    cancelOrder() {
      this.setData({
        show: false
      })
    },

    //确认订单
    okOrder() {
      let params = {
        orderid: this.data.fatherData
      }

      this.setData({
        show: false
      })
      sureOrder(params).then((res) => {
     
        if (res.errcode == 0) {
          wx.showToast({
            title: '已确认收货',
            icon: 'success',
            image: '',
            duration: 1500,
            mask: false,
            success: (result) => {
              setTimeout(() => {
                this.triggerEvent("parentFun");
              }, 1000);
            },
          });

        } else {
          wx.showToast({
            title: res.errmsg,
            icon: 'none',
          });

        }
      })




    },

  }
})
